<template>
  <div>
    <head1/>
    <div style="position: absolute;top: 60px;left: 200px">
      <p>组织名称：<input type="text">
        <van-button>查询</van-button>
        <van-button>重置</van-button>
      </p >
      <p>
        <van-button style="background-color: cornflowerblue" @click="this.zt=true">+新增</van-button>
        <van-uploader :after-read="afterRead">
          <van-button icon="plus" type="primary">导入</van-button>
        </van-uploader>
        <van-button>导出</van-button>
      </p >
      <div v-show="zt">
          <van-field  label="组织名称" v-model="from.name"/>
          <van-field  label="组织编码" v-model="from.coding"/>
          <van-field  label="创建人" v-model="from.createpeople"/>
          <van-button @click="add_organization">确认</van-button>
          <van-button @click="this.zt=false">关闭</van-button>
      </div>



    </div>
    <menu1/>

  </div>

</template>

<script>
import axios from "axios";
import maxios from "../../http/axios";
import menu from "./公共/menu";
import head from "./公共/head";

export default {
  name: "organization",
  data(){
    return{
      from:{},
      zt:false,
      list:[]
    }
  },
  methods:{
    add_organization(){
      maxios('com/org_add','post',this.from)
      .then(i=>{
        if (i.code==200){
          alert(i.data.mes)
        }
        else {
          alert(i.data.mes)
        }
      })
    },
    show_organization(){
      maxios('com/org_add','get')
      .then(i=>{
        this.list = i.data.list
      })
    },
    afterRead(file){
      let from = new FormData()
      from.append('file',file.file)
      axios({url:'http://127.0.0.1:5000/com/file_add',method:'post',data:from})
      .then(i=>{
        console.log(i)
      })
    }
  },
  mounted() {
    this.show_organization()
  },
  components:{
    'menu1':menu,
    'head1':head
  },
}
</script>

<style scoped>

</style>